package pers.qianyu.month_202102.date_20210215;

/**
 * 485. 最大连续1的个数
 * https://leetcode-cn.com/problems/max-consecutive-ones/
 *
 * @author mizzle rain
 * @date 2021-02-15 15:27
 */
public class FindMaxConsecutiveOnes {
    public int findMaxConsecutiveOnes(int[] nums) {
        int cnt = 0, res = 0;
        for (int x : nums) {
            if (x == 1) cnt++;
            else cnt = 0;
            res = Math.max(res, cnt);
        }
        return res;
    }
}
